<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>20.构造函数方法继承</title>
</head>

<body>
  <script>
    //使用call / apply 方法实现方法继承
    function Request () {
      this.get = function (params = {}) {
        console.log(params);
        let str = Object.keys(params)
          .map(k => `${k}=${params[k]}`)
          .join("&");
        let url = `https://houdunren.com/${this.url}?${str}`;
        document.write(url + "<hr/>")
      }
    }
    function Article () {
      this.url = "article/lists";
      Request.apply(this);
    }
    let article = new Article();
    article.get({
      row: 10,
      start: 3
    });
    function Lesson () {
      this.url = "lesson/index";
      Request.call(this);
    }
    let lesson = new Lesson();
    lesson.get({
      row: 20
    });
  </script>
</body>

</html>